@echo off
echo Kotlin语法检查...
echo.

echo [1/5] 检查包声明和导入...
findstr /n "package\|import" app\src\main\java\com\example\appusagestats\*.kt
findstr /n "package\|import" app\src\main\java\com\example\appusagestats\model\*.kt
findstr /n "package\|import" app\src\main\java\com\example\appusagestats\adapter\*.kt
findstr /n "package\|import" app\src\main\java\com\example\appusagestats\manager\*.kt
echo.

echo [2/5] 检查类定义...
findstr /n "class " app\src\main\java\com\example\appusagestats\*.kt
findstr /n "class " app\src\main\java\com\example\appusagestats\model\*.kt
findstr /n "class " app\src\main\java\com\example\appusagestats\adapter\*.kt
findstr /n "class " app\src\main\java\com\example\appusagestats\manager\*.kt
echo.

echo [3/5] 检查方法定义...
findstr /n "fun " app\src\main\java\com\example\appusagestats\*.kt
findstr /n "fun " app\src\main\java\com\example\appusagestats\model\*.kt
findstr /n "fun " app\src\main\java\com\example\appusagestats\adapter\*.kt
findstr /n "fun " app\src\main\java\com\example\appusagestats\manager\*.kt
echo.

echo [4/5] 检查大括号匹配...
echo MainActivity.kt:
findstr /c "{" app\src\main\java\com\example\appusagestats\MainActivity.kt | find /c "}"
echo 开放大括号数: 
findstr /c "{" app\src\main\java\com\example\appusagestats\MainActivity.kt | find /c "{"
findstr /c "}" app\src\main\java\com\example\appusagestats\MainActivity.kt | find /c "}"
echo.

echo [5/5] 检查已知问题模式...
echo 检查可能的字符串插值问题...
findstr /n "\${" app\src\main\java\com\example\appusagestats\*.kt
findstr /n "\${" app\src\main\java\com\example\appusagestats\model\*.kt
findstr /n "\${" app\src\main\java\com\example\appusagestats\adapter\*.kt
findstr /n "\${" app\src\main\java\com\example\appusagestats\manager\*.kt

echo 检查未解析的引用...
findstr /n "UsageStatsManager\|TimeSlot\|UsageEvent\|AppUsageInfo" app\src\main\java\com\example\appusagestats\*.kt

echo.
echo 语法检查完成！
pause
